package com.scau402.system1.domain.po;

import com.baomidou.mybatisplus.annotation.TableName;
import com.scau402.common.core.domain.entity.SysUser;
import com.scau402.system1.utils.IdGenerator;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.time.LocalDateTime;

/**
 * 审核单PO
 * @since 2024/2/5
 */
@Data
@NoArgsConstructor
@AllArgsConstructor
@TableName("wms_audit_order")
public class WmsAuditOrderPO {
    /**
     * 审核单id
     */
    private Long id;
    /**
     * 审核类型：0：价格调整、1：出借天数、2：库存调整
     */
    private String type;
    /**
     * 审核状态：0：待审核、1：审核通过、2：审核驳回
     */
    private String status;
    /**
     * 创建人员
     */
    private String createBy;
    /**
     * 审核人员
     */
    private String auditedBy;
    /**
     * 创建时间
     */
    private LocalDateTime createTime;
    /**
     * 审核时间
     */
    private LocalDateTime auditTime;
    /**
     * 更新时间
     */
    private LocalDateTime updateTime;
    /**
     * 租户id
     */
    private Long tenantId;
    /**
     * 部门id
     */
    private Long deptId;
    /**
     * 备注
     */
    private String remark;

    /**
     * 创建审核单
     * @param user 创建发起人
     * @param type 审核类型
     * @param id 发起单id——如库存调整单id/出库单id/价格调整单id等
     */
    public WmsAuditOrderPO(IdGenerator idGenerator, SysUser user, String type, Long id) {
        this.id = idGenerator.nextId("audit");
        this.type = type;
        this.status = "0";
        this.createBy = user.getUserName();
        this.createTime = LocalDateTime.now();
        this.updateTime = LocalDateTime.now();
        this.tenantId = user.getTenantId();
        this.deptId = user.getDeptId();
        this.remark = "";
    }
}
